package com.iwhalecloud.citybrain.flow.platform.manager.common.client;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import lombok.Data;


/**
 * @author lilh
 * @date 2019-02-18 20:41
 */
@Data
public class HttpCompleteWorkItemDto extends HttpCommandDto {
    private static final long serialVersionUID = 2455201360434840696L;

    private String workItemId;

    private String memo;

    private Map<String, Object> flowParamList;

    private Map<String, Object> flowPassList;

    private String participantId;

    private String participantName;

    private String participantType;

    private List<TaskReadDoDto> taskReadDoDtoList;

    public HttpCompleteWorkItemDto() {
        this.setCommandCode("completeWorkItem");
    }

    @Override
    public Map<String, Object> toMap() {
        Map<String, Object> map = super.toMap();
        map.put("WORKITEMID", this.workItemId);
        map.put("MEMO", this.memo);
        map.put("FLOW_PARAM_LIST", this.flowParamList);
        map.put("FLOW_PASS_LIST", this.flowPassList);
        map.put("PARTICIPANTID", this.participantId);
        map.put("PARTICIPANTNAME", this.participantName);
        map.put("PARTICIPANTTYPE", this.participantType);
        return map;
    }

    @SuppressWarnings("unchecked")
    @Override
    public void init(Map<String, Object> paramsMap) {
        super.init(paramsMap);
        this.workItemId = String.valueOf(paramsMap.get("WORKITEMID"));
        this.memo = String.valueOf(paramsMap.get("MEMO"));
        this.flowParamList = (Map) paramsMap.get("FLOW_PARAM_LIST");
        if (paramsMap.get(FLOW_PASS_LIST_STR) != null) {
            this.flowPassList = (Map) paramsMap.get("FLOW_PASS_LIST");
        }

        this.participantId = (String) paramsMap.get("PARTICIPANTID");
        this.participantName = (String) paramsMap.get("PARTICIPANTNAME");
        this.participantType = (String) paramsMap.get("PARTICIPANTTYPE");

    }


}
